package chat;

import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import java.awt.Dimension;
import javax.swing.JScrollPane;
import java.awt.Font;

public class ChattingPanel1 extends JPanel {
	String Message = "";
	ChattingTest1 chattingTest1 = null;
	private JPanel panel;
	private JLabel lbl_name;
	private JTextArea txt;

	/**
	 * Create the panel.
	 */
	public ChattingPanel1(String Message) {
		setLayout(new BorderLayout(0, 0));
		add(getPanel(), BorderLayout.CENTER);
		
		txt.setText(Message);
		int a = txt.getLineCount();
		System.out.println(a);
		//setPreferredSize(panel.getSize());
	}
	
	public void setPanel(ChattingTest1 chattingTest1){
		this.chattingTest1 = chattingTest1;
	}
	
	private JPanel getPanel() {
		if (panel == null) {
			panel = new JPanel();
			//panel.setPreferredSize(panel.getPreferredSize());
			panel.setLayout(new BorderLayout(0, 0));
			panel.add(getLbl_name(), BorderLayout.NORTH);
			panel.add(getTextArea_1(), BorderLayout.CENTER);
		}
		return panel;
	}
	private JLabel getLbl_name() {
		if (lbl_name == null) {
			lbl_name = new JLabel("박원기");
			lbl_name.setFont(new Font("맑은 고딕", Font.BOLD, 12));
			lbl_name.setOpaque(true);
		}
		return lbl_name;
	}
	public JTextArea getTextArea_1() {
		if (txt == null) {
			txt = new JTextArea();
			txt.setLineWrap(true);
			txt.setWrapStyleWord(true);
			txt.setFocusable(false);
			txt.setMinimumSize(new Dimension(30, 50));
			txt.setText("안녕하세요. 저는 공소영입니다 어너제나 채팅창을 잘 하고 싶죠그러나 삶은 그렇게 쉽게 되지 않는군요흑흑흑흑");
		}
		return txt;
	}
}


